home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / p_man / cat3 / f90 / cshift.z / cshift
Text File  |  1998-10-30  |  5KB  |  121 lines

  1. CSHIFT(3I)                                             Last changed: 1-6-98
  2.  
  3.  
  4. NNAAMMEE
  5.      CCSSHHIIFFTT - Performs a circular shift on an array expression
  6.  
  7. SSYYNNOOPPSSIISS
  8.      CCSSHHIIFFTT (([AARRRRAAYY==]_a_r_r_a_y,, [SSHHIIFFTT==]_s_h_i_f_t [,, [DDIIMM==]_d_i_m]))
  9.  
  10. IIMMPPLLEEMMEENNTTAATTIIOONN
  11.      UNICOS, UNICOS/mk, and IRIX systems
  12.  
  13. SSTTAANNDDAARRDDSS
  14.      Fortran 90
  15.  
  16. DDEESSCCRRIIPPTTIIOONN
  17.      The CCSSHHIIFFTT intrinsic function performs a circular shift on an array
  18.      expression of rank 1 or performs circular shifts on all the complete
  19.      rank 1 sections along a given array expression of rank 2 or greater.
  20.      Elements shifted out at one end are shifted in at the other end.
  21.      Different sections can be shifted by different amounts and in
  22.      different directions; positive for left shifts, negative for right
  23.      shifts.
  24.  
  25.      CCSSHHIIFFTT accepts the following arguments:
  26.  
  27.      _a_r_r_a_y     Can be of any type.  It must not be a scalar.
  28.  
  29.      _s_h_i_f_t     Must be integer.  If _a_r_r_a_y has rank 1, _s_h_i_f_t must be a
  30.                scalar.  Otherwise, _s_h_i_f_t must be scalar or have rank _n-1
  31.                and have
  32.                shape (_d , _d , ..., _d     , _d     , ..., _d ),
  33.                        1   2        _d_i_m-1   _d_i_m+1        _n
  34.                where (_d , _d , ..., _d )
  35.                        1   2        _n
  36.                is the shape of _a_r_r_a_y.
  37.  
  38.      _d_i_m       Must be a scalar.  It is an integer with a value in the
  39.                range 1 <= _d_i_m <= _n, where _n is the rank of _a_r_r_a_y.  If _d_i_m
  40.                is omitted, a value of 1 is assumed.
  41.  
  42.      CCSSHHIIFFTT is a transformational function.  The name of this intrinsic
  43.      cannot be passed as an argument.
  44.  
  45. RREETTUURRNN VVAALLUUEESS
  46.      The result is an array of the same type, type parameters, and shape as
  47.      _a_r_r_a_y.
  48.  
  49.      If _a_r_r_a_y has rank 1, element _i of the result is
  50.      _a_r_r_a_y(1 + _m_o_d_u_l_o(_i + _s_h_i_f_t - 1, _s_i_z_e(_a_r_r_a_y))).
  51.  
  52.      If _a_r_r_a_y has rank greater than 1,
  53.      section (_s , _s , ..., _s     , : , _s     , ..., _s )
  54.                1   2        _d_i_m-1       _d_i_m+1        _n
  55.      of the result has a value equal to
  56.      CCSSHHIIFFTT(_a_r_r_a_y (_s , _s , ..., _s     , : , _s     , ..., _s ), _s_h, 1),
  57.                     1   2        _d_i_m-1       _d_i_m+1        _n
  58.      where _s_h is _s_h_i_f_t or
  59.      _s_h_i_f_t(_s , _s , ..., _s     , _s     , ..., _s )
  60.             1   2        _d_i_m-1   _d_i_m+1        _n
  61.  
  62. EEXXAAMMPPLLEESS
  63.      Example 1:  If VV is a rank 1 array [[11,, 22,, 33,, 44,, 55,, 66]], the effect of
  64.      shifting VV circularly to the left by two positions is achieved by
  65.      CCSSHHIIFFTT (( VV,, SSHHIIFFTT == 22)), which has the value [[33,, 44,, 55,, 66,, 11,, 22]].
  66.      Specifying CCSSHHIIFFTT (( VV,, SSHHIIFFTT == --22 )) achieves a circular shift to the
  67.      right by two positions and has the value [[55,, 66,, 11,, 22,, 33,, 44]].
  68.  
  69.      Example 2:  The rows of an array of rank 2 can all be shifted by the
  70.      same amount or by different amounts.  Assume MM is the following array:
  71.  
  72.         | 1 2 3 |
  73.  
  74.         | 4 5 6 |
  75.  
  76.         | 7 8 9 |
  77.  
  78.      The value of CCSSHHIIFFTT((MM,, SSHHIIFFTT ==--11,, DDIIMM == 22)) is as follows:
  79.  
  80.         | 3 1 2 |
  81.  
  82.         | 6 4 5 |
  83.  
  84.         | 9 7 8 |
  85.  
  86.      The value of CCSSHHIIFFTT((MM,, SSHHIIFFTT ==((// --11,, 11,, 00 //)),, DDIIMM == 22)) is as follows:
  87.  
  88.         | 3 1 2 |
  89.  
  90.         | 5 6 4 |
  91.  
  92.         | 7 8 9 |
  93.  
  94.      Example 3:  NN is the following array:
  95.  
  96.         | 1 2 3 4 |
  97.  
  98.         | 5 6 7 8 |
  99.  
  100.         | 9 10 11 12 |
  101.  
  102.      The value of CCSSHHIIFFTT((NN,, SSHHIIFFTT ==--11,, DDIIMM == 11)) is as follows:
  103.  
  104.         | 9 10 11 12 |
  105.  
  106.         | 1 2 3 4 |
  107.  
  108.         | 5 6 7 8 |
  109.  
  110.      With an array section of multidimensional array NN, the value of
  111.      SSHHIIFFTT((NN((22::33,,22::44)),, SSHHIIFFTT==--11,, DDIIMM==11)) is as follows:
  112.  
  113.         | 10 11 12 |
  114.  
  115.         | 6 7 8 |
  116.  
  117. SSEEEE AALLSSOO
  118.      _I_n_t_r_i_n_s_i_c _P_r_o_c_e_d_u_r_e_s _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l, publication SR-2138, for the
  119.      printed version of this man page.
  120.  
  121.